/**
* Author: CZ (cz.devnet@gmail.com)
*
* Description:
 */

package main

import (
	"fmt"
)

func init() {

}

func NewBag() *Bag {
	bag := &Bag{}
	bag.init()
	return bag
}

type Bag struct {
	alarm *Alarm
	texts []string
}

func (b *Bag) init() {

}

func (b *Bag) Freight(texts []string) {
	if nil == b.texts {
		b.texts = texts
		b.alarmMsg(texts)
		return
	}
	tail := b.texts[0]
	var newText []string
	for _, text := range texts {
		if text != tail {
			newText = append(newText, text)
		} else {
			break
		}
	}
	b.texts = texts
	b.alarmMsg(newText)
}

func (b *Bag) alarmMsg(texts []string) {
	fmt.Printf("Alarm:%v \n", texts)
}
